﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Yipusoft.SixAcquaint.Model;
using Yipusoft.SixAcquaint.BLL;

public partial class BasicBase_KeyUnit_KeyUnitView : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
       
            if (!string.IsNullOrEmpty(Request["ID"]))
            {
                KeyUnitInfo keyUnitDetails = KeyUnit.GetKeyUnitInfoByID(Request["ID"]);
                lblDepartment.Text = keyUnitDetails.UnitName + "概况统计表重点部位情况统计表";
                lblFaRenDB.Text = keyUnitDetails.FaRenTel == "" ? keyUnitDetails.FaRenDaiBiao : keyUnitDetails.FaRenDaiBiao + "（" + keyUnitDetails.FaRenTel + ")";
                lblXFFuZeRen.Text = keyUnitDetails.FuZeRenTel == "" ? keyUnitDetails.XiaoFangFuZeRen : keyUnitDetails.XiaoFangFuZeRen + "(" + keyUnitDetails.FuZeRenTel + ")";
                lblZhanDiMJ.Text = keyUnitDetails.ZhDArea.ToString();
                lblJianZhuMJ.Text = keyUnitDetails.JZhArea.ToString();
                lblSuoYouZhi.Text = keyUnitDetails.SuoYouZhi;
                lblGuDingZCh.Text = keyUnitDetails.GuDingZiChan.ToString();
                lblNianZChZh.Text = keyUnitDetails.NianZongChanZhi.ToString();
                lblDong.Text = keyUnitDetails.East;
                lblXi.Text = keyUnitDetails.West;
                lblNan.Text = keyUnitDetails.South;
                lblBei.Text = keyUnitDetails.North;
                UnitFireServiceInfo fireForceDetails = KeyUnit.GetFireForceInfoByID(Request["ID"]);
                if (fireForceDetails != null)
                {
                    lblYiWu.Text = fireForceDetails.PrivateFireMen.ToString();
                    lblZhuanZhi.Text = fireForceDetails.FullTimeFireMen.ToString();
                    lblZhiHuiShi.Text = fireForceDetails.CommandCenter;
                }
                BindVehicle();
                BindKeyPoint();
                BindHydrants();
                BindService();
                BindExtinguishSystem();
                BindOtherWater();
            }

        }
    }

    private void BindVehicle()
    {
        gvFFVehicle.DataSource = KeyUnitVehicle.GetVehicleByKeyUnitID(Request["ID"]);
        gvFFVehicle.DataBind();
    }

    private void BindKeyPoint()
    {
        rpKeyPoint.DataSource = KeyUnit.GetKeyPointListByKeyUnitID(Request["ID"]);
        rpKeyPoint.DataBind();
    }

    private void BindHydrants()
    {
        gvHydrants.DataSource = Water.GetKeyUnitHydrantsByKeyUnitID(Request["ID"]);
        gvHydrants.DataBind();
    }

    private void BindService()
    {
        gvService.DataSource = KeyUnit.GetServiceByKeyUnitID(Request["ID"]);
        gvService.DataBind();
    }

    private void BindExtinguishSystem()
    {
        gvEx.DataSource = KeyUnit.GetExtinguishSystemByKeyUnitID(Request["ID"]);
        gvEx.DataBind();
    }

    private void BindOtherWater()
    {
        gvOtherWater.DataSource = KeyUnit.GetOtherWaterByKeyUnitID(Request["ID"]);
        gvOtherWater.DataBind();
    }
 
}